<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Board game project: BreakthroughGame Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Board game project
   &#160;<span id="projectnumber">1.0</span>
   </div>
   <div id="projectbrief">A Board game software</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.8.0 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div>
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">BreakthroughGame Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>A <a class="el" href="class_breakthrough_game.html" title="A BreakthroughGame class.">BreakthroughGame</a> class.  
 <a href="class_breakthrough_game.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="_breakthrough_game_8h_source.html">BreakthroughGame.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for BreakthroughGame:</div>
<div class="dyncontent">
 <div class="center">
  <img src="class_breakthrough_game.png" usemap="#BreakthroughGame_map" alt=""/>
  <map id="BreakthroughGame_map" name="BreakthroughGame_map">
<area href="class_game.html" title="A Game class." alt="Game" shape="rect" coords="0,0,120,24"/>
</map>
 </div></div>

<p><a href="class_breakthrough_game-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a8b4664b87db09c7fcdb3bb70fdbcf968"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_breakthrough_game.html#a8b4664b87db09c7fcdb3bb70fdbcf968">BreakthroughGame</a> ()</td></tr>
<tr class="memdesc:a8b4664b87db09c7fcdb3bb70fdbcf968"><td class="mdescLeft">&#160;</td><td class="mdescRight">Breakthrough constructor.  <a href="#a8b4664b87db09c7fcdb3bb70fdbcf968"></a><br/></td></tr>
<tr class="memitem:ade5f4effccbb408e7545d93deed918c0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_breakthrough_game.html#ade5f4effccbb408e7545d93deed918c0">setBoard</a> ()</td></tr>
<tr class="memdesc:ade5f4effccbb408e7545d93deed918c0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set Board.  <a href="#ade5f4effccbb408e7545d93deed918c0"></a><br/></td></tr>
<tr class="memitem:a235177e42711a4aa2c90ac630def142f"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_breakthrough_game.html#a235177e42711a4aa2c90ac630def142f">displayBoard</a> ()</td></tr>
<tr class="memdesc:a235177e42711a4aa2c90ac630def142f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Display board.  <a href="#a235177e42711a4aa2c90ac630def142f"></a><br/></td></tr>
<tr class="memitem:af0267e49d572db8f52885870cca25ea5"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_breakthrough_game.html#af0267e49d572db8f52885870cca25ea5">start</a> ()</td></tr>
<tr class="memdesc:af0267e49d572db8f52885870cca25ea5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Start.  <a href="#af0267e49d572db8f52885870cca25ea5"></a><br/></td></tr>
<tr class="memitem:a26d176fd3278fed27908822a42b10a4f"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_breakthrough_game.html#a26d176fd3278fed27908822a42b10a4f">movePiece</a> (int fromX, int fromY, int toX, int toY)</td></tr>
<tr class="memdesc:a26d176fd3278fed27908822a42b10a4f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Move <a class="el" href="class_piece.html" title="A Piece class.">Piece</a>.  <a href="#a26d176fd3278fed27908822a42b10a4f"></a><br/></td></tr>
<tr class="memitem:a7849c63ba5de5b52fcb273a5f4a38ebd"><td class="memItemLeft" align="right" valign="top">std::vector&lt; <a class="el" href="struct_m_o_v_e.html">MOVE</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_breakthrough_game.html#a7849c63ba5de5b52fcb273a5f4a38ebd">legal</a> (GameBoard state)</td></tr>
<tr class="memdesc:a7849c63ba5de5b52fcb273a5f4a38ebd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get legal moves.  <a href="#a7849c63ba5de5b52fcb273a5f4a38ebd"></a><br/></td></tr>
<tr class="memitem:a04c7358b62c4202e5b9cb44c42f2a3de"><td class="memItemLeft" align="right" valign="top">virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_breakthrough_game.html#a04c7358b62c4202e5b9cb44c42f2a3de">winningState</a> ()</td></tr>
<tr class="memdesc:a04c7358b62c4202e5b9cb44c42f2a3de"><td class="mdescLeft">&#160;</td><td class="mdescRight">Winning state.  <a href="#a04c7358b62c4202e5b9cb44c42f2a3de"></a><br/></td></tr>
<tr class="memitem:aed2cfefe8b94025794fd91722fe12d43"><td class="memItemLeft" align="right" valign="top">virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_breakthrough_game.html#aed2cfefe8b94025794fd91722fe12d43">advancedEvaluate</a> ()</td></tr>
<tr class="memdesc:aed2cfefe8b94025794fd91722fe12d43"><td class="mdescLeft">&#160;</td><td class="mdescRight">Advanced evaluation.  <a href="#aed2cfefe8b94025794fd91722fe12d43"></a><br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>A class that extends from <a class="el" href="class_game.html" title="A Game class.">Game</a> and defines the Breakthrough game with an 8x8 board. </p>
</div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a8b4664b87db09c7fcdb3bb70fdbcf968"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="class_breakthrough_game.html#a8b4664b87db09c7fcdb3bb70fdbcf968">BreakthroughGame::BreakthroughGame</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Constructs the game. Calls <a class="el" href="class_breakthrough_game.html#ade5f4effccbb408e7545d93deed918c0" title="Set Board.">setBoard()</a>. </p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="aed2cfefe8b94025794fd91722fe12d43"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="class_breakthrough_game.html#aed2cfefe8b94025794fd91722fe12d43">BreakthroughGame::advancedEvaluate</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>The advanced evaluation value using piece distances from the goal. </p>
<dl class="section return"><dt>Returns:</dt><dd>The sum of the current player's pieces subtracted by the other player's pieces. </dd></dl>

<p>Implements <a class="el" href="class_game.html">Game</a>.</p>

</div>
</div>
<a class="anchor" id="a235177e42711a4aa2c90ac630def142f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="class_breakthrough_game.html#a235177e42711a4aa2c90ac630def142f">BreakthroughGame::displayBoard</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Uses <a class="el" href="class_game.html#a63c52c475debbced9961d7fd1e02366e" title="Display Board.">Game::displayBoard()</a> and displays additional debug information if debugging is on. </p>

<p>Reimplemented from <a class="el" href="class_game.html#a63c52c475debbced9961d7fd1e02366e">Game</a>.</p>

</div>
</div>
<a class="anchor" id="a7849c63ba5de5b52fcb273a5f4a38ebd"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">vector&lt; <a class="el" href="struct_m_o_v_e.html">MOVE</a> &gt; <a class="el" href="class_breakthrough_game.html#a7849c63ba5de5b52fcb273a5f4a38ebd">BreakthroughGame::legal</a> </td>
          <td>(</td>
          <td class="paramtype">GameBoard&#160;</td>
          <td class="paramname"><em>state</em></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Returns vector of legal MOVEs for the given state using the Breakthrough game rules. </p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">state</td><td>The state to find legal moves for. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns:</dt><dd>Vector of MOVEs </dd></dl>

<p>Implements <a class="el" href="class_game.html#a4d3236f38eb3209135cb978b60c24d31">Game</a>.</p>

</div>
</div>
<a class="anchor" id="a26d176fd3278fed27908822a42b10a4f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="class_breakthrough_game.html#a26d176fd3278fed27908822a42b10a4f">BreakthroughGame::movePiece</a> </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>fromX</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>fromY</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>toX</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>toY</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Tries to moves the piece from (fromX,fromY) to (toX,toY) Outputs an error if the move is illegal or no legal moves are found.</p>
<dl class="params"><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">fromX,fromY</td><td>The source coordinate. </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">toX,toY</td><td>The destination coordinate. </td></tr>
  </table>
  </dd>
</dl>

<p>Implements <a class="el" href="class_game.html#acfbe6d42cabd6bf9820b8ccf13cda6cb">Game</a>.</p>

</div>
</div>
<a class="anchor" id="ade5f4effccbb408e7545d93deed918c0"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="class_breakthrough_game.html#ade5f4effccbb408e7545d93deed918c0">BreakthroughGame::setBoard</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Sets the board with 8 pieces for each player on opposite sides. </p>

<p>Implements <a class="el" href="class_game.html#a2e7c8cb10506b66e7d95a6efd21e778c">Game</a>.</p>

</div>
</div>
<a class="anchor" id="af0267e49d572db8f52885870cca25ea5"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void <a class="el" href="class_breakthrough_game.html#af0267e49d572db8f52885870cca25ea5">BreakthroughGame::start</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Displays a welcome message, initializes the game and starts it. </p>

<p>Implements <a class="el" href="class_game.html#add988158041df85337995e36f06756aa">Game</a>.</p>

</div>
</div>
<a class="anchor" id="a04c7358b62c4202e5b9cb44c42f2a3de"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="class_breakthrough_game.html#a04c7358b62c4202e5b9cb44c42f2a3de">BreakthroughGame::winningState</a> </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>Checks if the game is a tie by using <a class="el" href="class_game.html#a188c50dbdf4bdc68deadf87e5b8cf087" title="Winning state.">Game::winningState()</a>. Checks for a winner using the Breakthrough game rules. </p>
<dl class="section return"><dt>Returns:</dt><dd>2 if the game is a tie, 0 if player 1 wins, 1 if player 2 wins, -1 if noone is a winner. </dd></dl>

<p>Reimplemented from <a class="el" href="class_game.html#a188c50dbdf4bdc68deadf87e5b8cf087">Game</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>include/<a class="el" href="_breakthrough_game_8h_source.html">BreakthroughGame.h</a></li>
<li>src/BreakthroughGame.cpp</li>
</ul>
</div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated on Sat May 12 2012 03:23:28 for Board game project by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>

</body>
</html>
